package question4;

import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;

public class Main {

    boolean[] visit;

    public boolean getResult(int[] arr, int index) {
        visit = new boolean[arr.length];
        boolean dfs = dfs(arr, index);
        return dfs;
    }

    public boolean dfs(int[] arr, int index) {
        if (index >= arr.length || index < 0 || visit[index]) {
            return false;
        }
        if (arr[index] == 0) {
            return true;
        }
        visit[index] = true;
        boolean result = dfs(arr, index+arr[index]) ||
                dfs(arr, index-arr[index]);
        return result;
    }

    public static void main(String[] args) {
        System.out.println('a');
    }
}
